Skip to content

chore(bigframes): add specific build script for doctest to restrict execution#16711

Merged
chelsea-lin merged 27 commits intomainfrom
feat-bigframes-doctest-control
Apr 24, 2026
Merged

chore(bigframes): add specific build script for doctest to restrict execution#16711
chelsea-lin merged 27 commits intomainfrom
feat-bigframes-doctest-control

Conversation

@chalmerlowe
Copy link
Copy Markdown
Contributor

@chalmerlowe chalmerlowe commented Apr 17, 2026

Warning

This is a work in progress. Do not review until invited.

Creates a build script: packages/bigframes/scripts/run_doctest.sh. This script checks if bigframes has any changes (or if it's a continuous build) before runnin' the cleanup doctest sessions. This will prevent it from running when other packages are modified and failing the build.

Updates the Kokoro config: .kokoro/presubmit/presubmit-doctest-bigframes.cfg to set TRAMPOLINE_BUILD_FILE to point to the new script.

@chalmerlowe chalmerlowe requested review from a team as code owners April 17, 2026 15:30
@chalmerlowe chalmerlowe requested review from GarrettWu and removed request for a team April 17, 2026 15:30
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new presubmit configuration and a bash script, run_doctest.sh, to automate doctests for the bigframes package. The script detects changes using git diff and executes nox sessions accordingly. The review feedback identifies several critical improvements for the bash script: correcting the nox command syntax to handle multiple sessions properly, adding necessary quoting to handle file paths with spaces, and implementing checks for Kokoro environment variables to prevent syntax errors in non-pull request builds.

Comment thread packages/bigframes/scripts/run_doctest.sh Outdated
Comment thread packages/bigframes/scripts/run_doctest.sh Outdated
Comment thread packages/bigframes/scripts/run_doctest.sh Outdated
Comment thread packages/bigframes/scripts/run_doctest.sh Outdated
@parthea
Copy link
Copy Markdown
Contributor

parthea commented Apr 17, 2026

Switching to draft until checks are green

------------------------------------------------------------
Running doctest for: bigframes
------------------------------------------------------------
nox > Error while collecting sessions.
nox > Sessions not found: cleanup doctest

@parthea parthea marked this pull request as draft April 17, 2026 15:38
parthea
parthea previously approved these changes Apr 17, 2026
@parthea parthea dismissed their stale review April 17, 2026 19:43

I just noticed that the test is skipped in the output

nox > Running session doctest
nox > Creating virtual environment (virtualenv) using python3.12 in .nox/doctest
nox > Session doctest skipped: Temporary skip to enable a PR merge. Remove skip as part of closing https://github.com/googleapis/google-cloud-python/issues/16489.
cleanup
@chalmerlowe chalmerlowe self-assigned this Apr 17, 2026
@chalmerlowe chalmerlowe changed the title chore(bigframes): add specific build script for doctest to restrict execution [WIP] chore(bigframes): add specific build script for doctest to restrict execution Apr 17, 2026
Comment thread packages/bigframes/scripts/run_doctest.sh Outdated
Comment thread packages/bigframes/scripts/run_doctest.sh Outdated
>>> srs = series.Series([{"version": 1, "project": "pandas"}, {"version": 2, "project": "numpy"},])
>>> df = srs.struct.explode()
>>> df = df[["project", "version"]] # set the column order to ensure stable output for doctest
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-deterministic nature of a number of tests and doctests was really brutal.
This change helps avoid test failures in non-deterministic result generation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a valid bug and assigned to myself b/506201379.

{"version": 1, "project": "pandas"},
{"version": 2, "project": "numpy"},
{"project": "pandas", "version": 1},
{"project": "numpy", "version": 2},
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file help avoid test failures in non-deterministic result generation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. It should be fixed by b/506201379

if bf_div_result.dtype == pd.Int64Dtype():
bigframes.testing.utils.assert_series_equal(
pd_div_result, bf_div_result.to_pandas()
pd_div_result, bf_div_result.to_pandas(), check_dtype=False
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file helps avoid test failures due to type checking.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a recent regression or mypy failure? Should we add a TODO with a link to a bug to follow up on it?

@chalmerlowe chalmerlowe changed the title [WIP] chore(bigframes): add specific build script for doctest to restrict execution chore(bigframes): add specific build script for doctest to restrict execution Apr 24, 2026
@chalmerlowe chalmerlowe marked this pull request as ready for review April 24, 2026 19:36
Copy link
Copy Markdown
Contributor

@chelsea-lin chelsea-lin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doctest captured some regressions (b/506201379) but can be fixed after this change in.

@chelsea-lin chelsea-lin merged commit 6dd1960 into main Apr 24, 2026
30 checks passed
@chelsea-lin chelsea-lin deleted the feat-bigframes-doctest-control branch April 24, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants